cd "C:\RCFS data and stata codes"

/*Appendix A2. General ability index: Principal component analysis*/

use General_ability_index.dta, clear

tabstat nlistfirm_total nlistind_total nlistsic_total nlistpos_total ceoinother multi_segment, stat(n min p1 p25 mean median p75 p99 max sd) long col(stat)

pwcorr nlistfirm_total nlistind_total nlistsic_total nlistpos_total ceoinother multi_segment, sig

*rotate, clear

pca nlistfirm_total nlistsic_total nlistpos_total ceoinother multi_segment, comp(1)
rotate, varimax
screeplot, yline(1) ci(het)

estat kmo

predict pc1, score


/*Table 1*/
use esgpay220922.dta, clear

/*Volatility of revenue*/

sort firmid
egen vol_rev = sd(total_rev_w), by(firmid) 
sum vol_rev, det


gen high_vol_rev=0
replace high_vol_rev=1 if vol_rev>   5920.416 /*greater than the mean*/
replace high_vol_rev=. if vol_rev==.
tab high_vol_rev
sum high_vol_rev, det

/* Market cap in billion SEK */
gen mcap_b = mcapsek_w/1000


tabstat csrcomp policyesg esg_score e_score s_score Tobins_q_w return_assets_w generalist CEO_age_bordex male tenure external_hire ceo_1styear ceo_on_brd firstdaughter d_nchild d_nms high_gov d_sum_environment high_vol_rev log_total_rev volatility1_w Firm_age diversification DE rd_exp_w_rev_w mcap_b, stat(n min p1 p25 mean median p75 p99 max sd) long col(stat) format(%9.4f)


/*Table 3*/
/*Panel A*/
use ceopay230113v3.dta, clear
tabstat finwgt revwgt costwgt earningwgt cashflowwgt capitalwgt marketwgt nonfinwgt esgwgt ewgt swgt customerwgt employeewgt opwgt stwgt  unwgt wgt_tot, stat(n min mean median max sd) long col(stat) format(%9.2f)

tabstat esgpay_stbon2 esgpay_comp2, stat(n min mean median max sd) long col(stat) format(%9.2f)

/*Panel B*/
use ceopay230113v2.dta
tabstat finwgt revwgt costwgt earningwgt cashflowwgt capitalwgt marketwgt nonfinwgt esgwgt ewgt swgt customerwgt employeewgt opwgt stwgt  unwgt wgt_tot, stat(n min mean median max sd) long col(stat) format(%9.2f)

tabstat esgpay_stbon2 esgpay_comp2, stat(n min mean median max sd) long col(stat) format(%9.2f)

/*Panel D*/
use pay2020final.dta
/*All firms & CEOs*/
reg d_target_met fin_metric_new, noconstant
outreg2 using csrcomp, stats(coef tstat)  bdec(4) tdec(3) e(all) excel replace
reg d_target_met esg_metric_new, noconstant
outreg2 using csrcomp, stats(coef tstat)  bdec(4) tdec(3) e(all) excel append
reg d_target_met e_metric_new, noconstant
outreg2 using csrcomp, stats(coef tstat)  bdec(4) tdec(3) e(all) excel append
reg d_target_met s_metric_new, noconstant
outreg2 using csrcomp, stats(coef tstat)  bdec(4) tdec(3) e(all) excel append
reg d_target_met customer_new, noconstant
outreg2 using csrcomp, stats(coef tstat)  bdec(4) tdec(3) e(all) excel append
reg d_target_met employee_new, noconstant
outreg2 using csrcomp, stats(coef tstat)  bdec(4) tdec(3) e(all) excel append

tabstat d_target_met, stats(n mean)

/*Generalists in well-governed firms*/
reg d_target_met fin_metric_new if generalist_new==1 & high_gov_new==1, noconstant
outreg2 using csrcomp, stats(coef tstat)  bdec(4) tdec(3) e(all) excel replace
reg d_target_met esg_metric_new if generalist_new==1 & high_gov_new==1, noconstant
outreg2 using csrcomp, stats(coef tstat)  bdec(4) tdec(3) e(all) excel append
reg d_target_met e_metric_new if generalist_new==1 & high_gov_new==1, noconstant
outreg2 using csrcomp, stats(coef tstat)  bdec(4) tdec(3) e(all) excel append
reg d_target_met s_metric_new if generalist_new==1 & high_gov_new==1, noconstant
outreg2 using csrcomp, stats(coef tstat)  bdec(4) tdec(3) e(all) excel append
reg d_target_met customer_new if generalist_new==1 & high_gov_new==1, noconstant
outreg2 using csrcomp, stats(coef tstat)  bdec(4) tdec(3) e(all) excel append
reg d_target_met employee_new if generalist_new==1 & high_gov_new==1, noconstant
outreg2 using csrcomp, stats(coef tstat)  bdec(4) tdec(3) e(all) excel append

tabstat d_target_met if generalist_new==1 & high_gov_new==1, stats(n mean)

/*Specialists in well-governed firms*/
reg d_target_met fin_metric_new if generalist_new==0 & high_gov_new==1, noconstant
outreg2 using csrcomp, stats(coef tstat)  bdec(4) tdec(3) e(all) excel replace
reg d_target_met esg_metric_new if generalist_new==0 & high_gov_new==1, noconstant
outreg2 using csrcomp, stats(coef tstat)  bdec(4) tdec(3) e(all) excel append
reg d_target_met e_metric_new if generalist_new==0 & high_gov_new==1, noconstant
outreg2 using csrcomp, stats(coef tstat)  bdec(4) tdec(3) e(all) excel append
reg d_target_met s_metric_new if generalist_new==0 & high_gov_new==1, noconstant
outreg2 using csrcomp, stats(coef tstat)  bdec(4) tdec(3) e(all) excel append
reg d_target_met customer_new if generalist_new==0 & high_gov_new==1, noconstant
outreg2 using csrcomp, stats(coef tstat)  bdec(4) tdec(3) e(all) excel append
reg d_target_met employee_new if generalist_new==0 & high_gov_new==1, noconstant
outreg2 using csrcomp, stats(coef tstat)  bdec(4) tdec(3) e(all) excel append

tabstat d_target_met if generalist_new==0 & high_gov_new==1, stats(n mean)

* Test for difference btw generalists & specialists in well-governed firms
gen fin_gen = fin_metric_new*generalist_new
gen esg_gen = esg_metric_new*generalist_new
gen e_gen = e_metric_new*generalist_new
gen s_gen = s_metric_new*generalist_new
gen customer_gen = customer_new*generalist_new
gen employee_gen = employee_new*generalist_new

reg d_target_met fin_metric_new generalist_new fin_gen if high_gov_new==1, noconstant
test fin_gen + generalist_new = 0

reg d_target_met esg_metric_new generalist_new esg_gen if high_gov_new==1, noconstant
test esg_gen + generalist_new = 0

reg d_target_met e_metric_new generalist_new e_gen if high_gov_new==1, noconstant
test e_gen + generalist = 0

reg d_target_met s_metric_new generalist_new s_gen, noconstant
test s_gen + generalist_new = 0

reg d_target_met customer_new generalist_new customer_gen if high_gov_new==1, noconstant
test customer_gen + generalist_new = 0

reg d_target_met employee_new generalist_new employee_gen if high_gov_new==1, noconstant
test employee_gen + generalist_new = 0

/*Panel E*/
gen d_fin_metric=0
replace d_fin_metric=1 if fin_metric_new==1 & d_target_met==1
replace d_fin_metric=. if fin_metric_new==. | d_target_met==.

gen d_esg_metric=0
replace d_esg_metric=1 if  esg_metric_new==1 & d_target_met==1
replace d_esg_metric=. if  esg_metric_new==. | d_target_met==.

gen d_e_metric=0
replace d_e_metric=1 if e_metric_new==1 & d_target_met==1
replace d_e_metric=. if e_metric_new==. | d_target_met==.

gen d_s_metric=0
replace d_s_metric=1 if s_metric_new==1 & d_target_met==1
replace d_s_metric=. if s_metric_new==. | d_target_met==.

gen d_customer=0
replace d_customer=1 if customer_new==1 & d_target_met==1
replace d_customer=. if customer_new==. | d_target_met==.

gen d_employee=0
replace d_employee=1 if employee_new==1 & d_target_met==1
replace d_employee=. if employee_new==. | d_target_met==.

/*All firms & CEOs*/
pwcorr d_fin_metric d_esg_metric d_e_metric d_s_metric d_customer d_employee, sig      

spearman d_fin_metric d_esg_metric d_e_metric d_s_metric d_customer d_employee, stats(rho p)      

ktau d_fin_metric d_esg_metric d_e_metric d_s_metric d_customer d_employee, stats(taua taub p)

/*Generalist CEOs*/
pwcorr d_fin_metric d_esg_metric d_e_metric d_s_metric d_customer d_employee if generalist_new==1, sig   

spearman d_fin_metric d_esg_metric d_e_metric d_s_metric d_customer d_employee if generalist==1, stats(rho p)      

ktau d_fin_metric d_esg_metric d_e_metric d_s_metric d_customer d_employee if generalist==1, stats(taua taub p)

/*Generalits in well-governed firms*/
pwcorr d_fin_metric d_esg_metric d_e_metric d_s_metric d_customer d_employee if generalist==1 & high_gov==1, sig      

spearman d_fin_metric d_esg_metric d_e_metric d_s_metric d_customer d_employee if generalist==1 & high_gov==1, stats(rho p)      

ktau d_fin_metric d_esg_metric d_e_metric d_s_metric d_customer d_employee if generalist==1 & high_gov==1, stats(taua taub p)

/*Table 4*/

use esgpay220922.dta, clear

/*Number of specialists/generalist*/
tabstat csrcomp policyesg esg_score e_score s_score Tobins_q_w return_assets_w CEO_age_bordex male tenure external_hire ceo_1styear ceo_on_brd firstdaughter d_nchild d_nms high_gov d_sum_environment log_total_rev volatility1_w Firm_age diversification DE rd_exp_w_rev_w, by(generalist) stat(n) long col(stat) 


/*coefficent=mean for generalist*/
reg csrcomp generalist, noconstant
outreg2 using csrcomp, stats(coef tstat)  bdec(3) tdec(3) e(all) excel replace
reg  policyesg generalist, noconstant
outreg2 using csrcomp, stats(coef tstat)  bdec(3) tdec(3) e(all) excel append
reg esg_score generalist, noconstant
outreg2 using csrcomp, stats(coef tstat)  bdec(3) tdec(3) e(all) excel append
reg  e_score generalist, noconstant
outreg2 using csrcomp, stats(coef tstat)  bdec(3) tdec(3) e(all) excel append
reg s_score generalist, noconstant
outreg2 using csrcomp, stats(coef tstat)  bdec(3) tdec(3) e(all) excel append
reg Tobins_q_w generalist, noconstant
outreg2 using csrcomp, stats(coef tstat)  bdec(3) tdec(3) e(all) excel append
reg return_assets_w generalist, noconstant
outreg2 using csrcomp, stats(coef tstat)  bdec(3) tdec(3) e(all) excel append
reg CEO_age_bordex generalist, noconstant
outreg2 using csrcomp, stats(coef tstat)  bdec(3) tdec(3) e(all) excel append
reg male generalist, noconstant
outreg2 using csrcomp, stats(coef tstat)  bdec(3) tdec(3) e(all) excel append
reg tenure generalist, noconstant
outreg2 using csrcomp, stats(coef tstat)  bdec(3) tdec(3) e(all) excel append
reg external_hire generalist, noconstant
outreg2 using csrcomp, stats(coef tstat)  bdec(3) tdec(3) e(all) excel append
reg ceo_1styear generalist, noconstant
outreg2 using csrcomp, stats(coef tstat)  bdec(3) tdec(3) e(all) excel append
reg ceo_on_brd generalist, noconstant
outreg2 using csrcomp, stats(coef tstat)  bdec(3) tdec(3) e(all) excel append
reg firstdaughter generalist, noconstant
outreg2 using csrcomp, stats(coef tstat)  bdec(3) tdec(3) e(all) excel append
reg d_nchild generalist, noconstant
outreg2 using csrcomp, stats(coef tstat)  bdec(3) tdec(3) e(all) excel append
reg d_nms generalist, noconstant
outreg2 using csrcomp, stats(coef tstat)  bdec(3) tdec(3) e(all) excel append
reg high_gov generalist, noconstant
outreg2 using csrcomp, stats(coef tstat)  bdec(3) tdec(3) e(all) excel append
reg d_sum_environment generalist, noconstant
outreg2 using csrcomp, stats(coef tstat)  bdec(3) tdec(3) e(all) excel append
reg log_total_rev generalist, noconstant
outreg2 using csrcomp, stats(coef tstat)  bdec(3) tdec(3) e(all) excel append
reg volatility1_w generalist, noconstant
outreg2 using csrcomp, stats(coef tstat)  bdec(3) tdec(3) e(all) excel append
reg  Firm_age generalist, noconstant
outreg2 using csrcomp, stats(coef tstat)  bdec(3) tdec(3) e(all) excel append
reg diversification generalist, noconstant
outreg2 using csrcomp, stats(coef tstat)  bdec(3) tdec(3) e(all) excel append
reg DE generalist, noconstant
outreg2 using csrcomp, stats(coef tstat)  bdec(3) tdec(3) e(all) excel append
reg rd_exp_w_rev_w generalist, noconstant
outreg2 using csrcomp, stats(coef tstat)  bdec(3) tdec(3) e(all) excel append


/*constant=mean for specialist
coefficient=difference*/

reg csrcomp generalist
outreg2 using csrcomp, stats(coef tstat)  bdec(3) tdec(3) e(all) excel replace
reg  policyesg generalist
outreg2 using csrcomp, stats(coef tstat)  bdec(3) tdec(3) e(all) excel append
reg esg_score generalist
outreg2 using csrcomp, stats(coef tstat)  bdec(3) tdec(3) e(all) excel append
reg  e_score generalist
outreg2 using csrcomp, stats(coef tstat)  bdec(3) tdec(3) e(all) excel append
reg s_score generalist
outreg2 using csrcomp, stats(coef tstat)  bdec(3) tdec(3) e(all) excel append
reg Tobins_q_w generalist
outreg2 using csrcomp, stats(coef tstat)  bdec(3) tdec(3) e(all) excel append
reg return_assets_w generalist
outreg2 using csrcomp, stats(coef tstat)  bdec(3) tdec(3) e(all) excel append
reg CEO_age_bordex generalist
outreg2 using csrcomp, stats(coef tstat)  bdec(3) tdec(3) e(all) excel append
reg male generalist
outreg2 using csrcomp, stats(coef tstat)  bdec(3) tdec(3) e(all) excel append
reg tenure generalist
outreg2 using csrcomp, stats(coef tstat)  bdec(3) tdec(3) e(all) excel append
reg external_hire generalist
outreg2 using csrcomp, stats(coef tstat)  bdec(3) tdec(3) e(all) excel append
reg ceo_1styear generalist
outreg2 using csrcomp, stats(coef tstat)  bdec(3) tdec(3) e(all) excel append
reg ceo_on_brd generalist
outreg2 using csrcomp, stats(coef tstat)  bdec(3) tdec(3) e(all) excel append
reg firstdaughter generalist
outreg2 using csrcomp, stats(coef tstat)  bdec(3) tdec(3) e(all) excel append
reg d_nchild generalist
outreg2 using csrcomp, stats(coef tstat)  bdec(3) tdec(3) e(all) excel append
reg d_nms generalist
outreg2 using csrcomp, stats(coef tstat)  bdec(3) tdec(3) e(all) excel append
reg high_gov generalist
outreg2 using csrcomp, stats(coef tstat)  bdec(3) tdec(3) e(all) excel append
reg d_sum_environment generalist
outreg2 using csrcomp, stats(coef tstat)  bdec(3) tdec(3) e(all) excel append
reg log_total_rev generalist
outreg2 using csrcomp, stats(coef tstat)  bdec(3) tdec(3) e(all) excel append
reg volatility1_w generalist
outreg2 using csrcomp, stats(coef tstat)  bdec(3) tdec(3) e(all) excel append
reg  Firm_age generalist
outreg2 using csrcomp, stats(coef tstat)  bdec(3) tdec(3) e(all) excel append
reg diversification generalist
outreg2 using csrcomp, stats(coef tstat)  bdec(3) tdec(3) e(all) excel append
reg DE generalist
outreg2 using csrcomp, stats(coef tstat)  bdec(3) tdec(3) e(all) excel append
reg rd_exp_w_rev_w generalist
outreg2 using csrcomp, stats(coef tstat)  bdec(3) tdec(3) e(all) excel append


/*Table 5*/
xtset firmid year

probit csrcomp  l.high_gov l.generalist  l.d_sum_environment l.CEO_age_bordex l.male l.tenure l.ceo_1styear l.ceo_on_brd l.log_total_rev l.Tobins_q_w l.return_assets_w l.volatility1_w l.Firm_age l.diversification sector1-sector11 i.year, r
outreg2 using csrcomp, stats(coef tstat)  bdec(4) tdec(3) e(all) excel replace
margins, dydx(*)  post
estimates store ME
outreg2 [ME] using csrcomp, stats(coef tstat)  bdec(4) tdec(3)  e(all) excel append

probit csrcomp  l.high_gov l.generalist l.generalist_high_gov l.d_sum_environment l.CEO_age_bordex l.male l.tenure l.ceo_1styear l.ceo_on_brd l.log_total_rev l.Tobins_q_w l.return_assets_w l.volatility1_w l.Firm_age l.diversification  sector1-sector11 i.year, r
outreg2 using csrcomp, stats(coef tstat)  bdec(4) tdec(3) e(all) excel append
margins, dydx(*)  post
estimates store ME
outreg2 [ME] using csrcomp, stats(coef tstat)  bdec(4) tdec(3)  e(all) excel append

reg csrcomp l.high_gov l.generalist  l.generalist_high_gov l.d_sum_environment l.CEO_age_bordex l.male l.tenure l.ceo_1styear l.ceo_on_brd l.log_total_rev l.Tobins_q_w l.return_assets_w l.volatility1_w l.Firm_age l.diversification sector1-sector11 i.year, r
outreg2 using csrcomp, stats(coef tstat)  bdec(4) tdec(3) e(all) excel append


/*For test of inteff*/

gen lgeneralist=l.generalist
gen lhigh_gov=l.high_gov
gen lgeneralist_high_gov=l.generalist_high_gov
gen ld_sum_environment=l.d_sum_environment
gen lCEO_age_bordex=l.CEO_age_bordex
gen lmale=l.male
gen ltenure=l.tenure
gen lceo_1styear=l.ceo_1styear
gen lceo_on_brd=l.ceo_on_brd
gen llog_total_rev=l.log_total_rev
gen lTobins_q_w=l.Tobins_q_w
gen lreturn_assets_w=l.return_assets_w
gen lvolatility1_w=l.volatility1_w
gen lFirm_age=l.Firm_age
gen ldiversification=l.diversification
tabulate year, generate(y) nofreq

probit csrcomp  lhigh_gov lgeneralist lgeneralist_high_gov ld_sum_environment lCEO_age_bordex lmale ltenure lceo_1styear lceo_on_brd llog_total_rev lTobins_q_w lreturn_assets_w lvolatility1_w lFirm_age ldiversification sector1-sector11 y1-y15, r

inteff csrcomp  lhigh_gov lgeneralist lgeneralist_high_gov ld_sum_environment lCEO_age_bordex lmale ltenure lceo_1styear lceo_on_brd llog_total_rev lTobins_q_w lreturn_assets_w lvolatility1_w lFirm_age ldiversification sector1-sector11 y1-y15



/*Table 6*/

/*Volatility of revenue*/

sort firmid
egen vol_rev = sd(total_rev_w), by(firmid) 
sum vol_rev, det


gen high_vol_rev=0
replace high_vol_rev=1 if vol_rev>   5920.416 /*greater than the mean*/
replace high_vol_rev=. if vol_rev==.
tab high_vol_rev
sum high_vol_rev, det


xtset firmid year

probit csrcomp l.generalist l.high_gov l.generalist_high_gov l.d_sum_environment l.CEO_age_bordex l.male l.tenure l.ceo_on_brd l.return_assets_w l.volatility1_w l.Firm_age l.diversification l.ceo_1styear sector1-sector11 i.year if high_vol_rev==1, r
outreg2 using csrcomp, stats(coef tstat)  bdec(4) tdec(3) e(all) excel replace
margins, dydx(*)  post
estimates store ME
outreg2 [ME] using csrcomp, stats(coef tstat)  bdec(4) tdec(3)  e(all) excel append

reg csrcomp l.generalist l.high_gov l.generalist_high_gov l.d_sum_environment l.CEO_age_bordex l.male l.tenure l.ceo_on_brd l.return_assets_w l.volatility1_w l.Firm_age l.diversification l.ceo_1styear sector1-sector11 i.year if high_vol_rev==1, r
outreg2 using csrcomp, stats(coef tstat)  bdec(4) tdec(3) e(all) excel append


probit csrcomp l.generalist l.high_gov l.generalist_high_gov l.d_sum_environment l.CEO_age_bordex l.male l.tenure l.ceo_on_brd l.return_assets_w l.volatility1_w l.Firm_age l.diversification l.ceo_1styear sector1-sector11 i.year if high_vol_rev==0, r
outreg2 using csrcomp, stats(coef tstat)  bdec(4) tdec(3) e(all) excel append
margins, dydx(*)  post
estimates store ME
outreg2 [ME] using csrcomp, stats(coef tstat)  bdec(4) tdec(3)  e(all) excel append

reg csrcomp l.generalist l.high_gov l.generalist_high_gov l.d_sum_environment l.CEO_age_bordex l.male l.tenure l.ceo_on_brd l.return_assets_w l.volatility1_w l.Firm_age l.diversification l.ceo_1styear sector1-sector11 i.year if high_vol_rev==0, r
outreg2 using csrcomp, stats(coef tstat)  bdec(4) tdec(3) e(all) excel append

/*ME of interaction effects*/

probit csrcomp lgeneralist lhigh_gov lgeneralist_high_gov ld_sum_environment lCEO_age_bordex lmale ltenure lceo_on_brd lreturn_assets_w lvolatility1_w lFirm_age ldiversification lceo_1styear sector1-sector11 y1-y15 if high_vol_rev==1, r

inteff csrcomp lgeneralist lhigh_gov lgeneralist_high_gov ld_sum_environment lCEO_age_bordex lmale ltenure lceo_on_brd lreturn_assets_w lvolatility1_w lFirm_age ldiversification lceo_1styear sector1-sector11 y1-y15 if high_vol_rev==1

probit csrcomp lgeneralist lhigh_gov lgeneralist_high_gov ld_sum_environment lCEO_age_bordex lmale ltenure lceo_on_brd lreturn_assets_w lvolatility1_w lFirm_age ldiversification lceo_1styear sector1-sector11 y1-y15 if high_vol_rev==0, r

inteff csrcomp lgeneralist lhigh_gov lgeneralist_high_gov ld_sum_environment lCEO_age_bordex lmale ltenure lceo_on_brd lreturn_assets_w lvolatility1_w lFirm_age ldiversification lceo_1styear sector1-sector11 y1-y15 if high_vol_rev==0



/*Table 7*/

/*ESG performance*/

tab csrcomp 
tab generalist
tab high_gov

gen csrcomp_high_gov=csrcomp*high_gov

gen csrcomp_high_gov_generalist=csrcomp*high_gov*generalist


reg esg_score l.csrcomp l.generalist  l.high_gov l.csrcomp_generalist l.csrcomp_high_gov l.generalist_high_gov l.csrcomp_high_gov_generalist l.return_assets_w l.CEO_age_bordex l.male l.tenure  l.volatility1_w  l.log_total_rev  l.ceo_1styear sector1-sector11 i.year [fweight=_weight], vce(cluster firmid)
outreg2 using csrcomp, stats(coef tstat)  bdec(4) tdec(3) e(all) excel replace

reg e_score l.csrcomp l.generalist  l.high_gov l.csrcomp_generalist l.csrcomp_high_gov l.generalist_high_gov l.csrcomp_high_gov_generalist l.return_assets_w l.CEO_age_bordex l.male l.tenure  l.volatility1_w  l.log_total_rev  l.ceo_1styear sector1-sector11 i.year [fweight=_weight], vce(cluster firmid)
outreg2 using csrcomp, stats(coef tstat)  bdec(4) tdec(3) e(all) excel append

reg s_score l.csrcomp l.generalist  l.high_gov l.csrcomp_generalist l.csrcomp_high_gov l.generalist_high_gov l.csrcomp_high_gov_generalist l.return_assets_w l.CEO_age_bordex l.male l.tenure  l.volatility1_w  l.log_total_rev  l.ceo_1styear sector1-sector11 i.year [fweight=_weight], vce(cluster firmid)
outreg2 using csrcomp, stats(coef tstat)  bdec(4) tdec(3) e(all) excel append


/*Test of difference*/

gen lcsrcomp_high_gov_generalist=l.csrcomp_high_gov_generalist

reg e_score l.csrcomp l.generalist  l.high_gov l.csrcomp_generalist l.csrcomp_high_gov l.generalist_high_gov lcsrcomp_high_gov_generalist l.return_assets_w l.CEO_age_bordex l.male l.tenure  l.volatility1_w  l.log_total_rev  l.ceo_1styear sector1-sector11 i.year [fweight=_weight]

est store tay1

reg s_score l.csrcomp l.generalist  l.high_gov l.csrcomp_generalist l.csrcomp_high_gov l.generalist_high_gov lcsrcomp_high_gov_generalist l.return_assets_w l.CEO_age_bordex l.male l.tenure  l.volatility1_w  l.log_total_rev  l.ceo_1styear sector1-sector11 i.year [fweight=_weight]

est store tay2

suest tay1 tay2, cluster(firmid)

test [tay1_mean]lcsrcomp_high_gov_generalist=[tay2_mean]lcsrcomp_high_gov_generalist


/*Broader measure Online Appendix OA1 Panel B*/

gen policyesg_high_gov=policyesg*high_gov

gen policyesg_high_gov_generalist=policyesg*high_gov*generalist

reg esg_score l.policyesg l.generalist  l.high_gov l.policyesg_generalist l.policyesg_high_gov l.generalist_high_gov l.policyesg_high_gov_generalist l.return_assets_w l.CEO_age_bordex l.male l.tenure  l.volatility1_w  l.log_total_rev  l.ceo_1styear sector1-sector11 i.year [fweight=_weight], vce(cluster firmid)
outreg2 using csrcomp, stats(coef tstat)  bdec(4) tdec(3) e(all) excel replace

reg e_score l.policyesg l.generalist  l.high_gov l.policyesg_generalist l.policyesg_high_gov l.generalist_high_gov l.policyesg_high_gov_generalist l.return_assets_w l.CEO_age_bordex l.male l.tenure  l.volatility1_w  l.log_total_rev  l.ceo_1styear sector1-sector11 i.year [fweight=_weight], vce(cluster firmid)
outreg2 using csrcomp, stats(coef tstat)  bdec(4) tdec(3) e(all) excel append

reg s_score l.policyesg l.generalist  l.high_gov l.policyesg_generalist l.policyesg_high_gov l.generalist_high_gov l.policyesg_high_gov_generalist l.return_assets_w l.CEO_age_bordex l.male l.tenure  l.volatility1_w  l.log_total_rev  l.ceo_1styear sector1-sector11 i.year [fweight=_weight], vce(cluster firmid)
outreg2 using csrcomp, stats(coef tstat)  bdec(4) tdec(3) e(all) excel append

/*Table 8*/

/*Financial performance*/

reg Tobins_q_w l.csrcomp l.generalist  l.high_gov l.csrcomp_generalist l.csrcomp_high_gov l.generalist_high_gov l.csrcomp_high_gov_generalist l.return_assets_w l.CEO_age_bordex l.male l.tenure  l.volatility1_w  l.log_total_rev  l.ceo_1styear sector1-sector11 i.year [fweight=_weight], vce(cluster firmid)
outreg2 using csrcomp, stats(coef tstat)  bdec(4) tdec(3) e(all) excel replace

reg  return_assets_w l.csrcomp l.generalist  l.high_gov l.csrcomp_generalist l.csrcomp_high_gov l.generalist_high_gov l.csrcomp_high_gov_generalist l.return_assets_w l.CEO_age_bordex l.male l.tenure  l.volatility1_w  l.log_total_rev  l.ceo_1styear sector1-sector11 i.year [fweight=_weight], vce(cluster firmid)
outreg2 using csrcomp, stats(coef tstat)  bdec(4) tdec(3) e(all) excel append


/*Broader measure  Online Appendix OA2 Panel B*/


reg Tobins_q_w l.policyesg l.generalist  l.high_gov l.policyesg_generalist l.policyesg_high_gov l.generalist_high_gov l.policyesg_high_gov_generalist l.return_assets_w l.CEO_age_bordex l.male l.tenure  l.volatility1_w  l.log_total_rev  l.ceo_1styear sector1-sector11 i.year [fweight=_weight], vce(cluster firmid)
outreg2 using csrcomp, stats(coef tstat)  bdec(4) tdec(3) e(all) excel replace

reg return_assets_w l.policyesg l.generalist  l.high_gov l.policyesg_generalist l.policyesg_high_gov l.generalist_high_gov l.policyesg_high_gov_generalist l.return_assets_w l.CEO_age_bordex l.male l.tenure  l.volatility1_w  l.log_total_rev  l.ceo_1styear sector1-sector11 i.year [fweight=_weight], vce(cluster firmid)
outreg2 using csrcomp, stats(coef tstat)  bdec(4) tdec(3) e(all) excel append


/*Table 9*/
/*Panel A*/
/*CAR*/
/*See output folder CAR*/
use departure220512.dta, clear

eventstudy2 isin_ann date using return220512.dta, returns(ret_w) mod(FM) marketfile(factor220512w.dta) mar(mr) idmar(cid) factor1(smb) factor2(hml) factor3(umd) risk(tbill) /*
*/ evwlb (-5) evwub(5)  eswlb(-250)  eswub(-20 )car1LB(0) car1UB(1) car2LB(-1) car2UB(1) car3LB(-1) car3UB(2) car4LB(-1) car4UB(3) car5LB(-1) car5UB(4)car6LB(-1) car6UB(5) replace



/*BHAR*/
/* 3-year BHAR: See output folder BHAR3y */
use departure220512.dta, clear
eventstudy2 isin_ann date using return220512.dta, ret(ret_w) mod(BHAR) marketfile(factor220512w.dta) mar(mr_w) idmar(cid) evwlb (-750) evwub(-20) car1LB(-750) car1UB(-20) fill replace


/* 2-year BHAR:See output folder BHAR2y */
use departure220512.dta, clear
eventstudy2 isin_ann date using return220512.dta, ret(ret_w) mod(BHAR) marketfile(factor220512w.dta) mar(mr_w) idmar(cid) evwlb (-500) evwub(-20) car1LB(-500) car1UB(-20) car2LB(-250) car2UB(-20) car3LB(-125) car3UB(-20) fill replace

/* 1-year BHAR: See output folder BHAR1y */
use departure220512.dta, clear
eventstudy2 isin_ann date using return220512.dta, ret(ret_w) mod(BHAR) marketfile(factor220512w.dta) mar(mr_w) idmar(cid) evwlb (-250) evwub(-20) car1LB(-250) car1UB(-20) car2LB(-125) car2UB(-20) fill replace


use departure220922.dta, clear

/*Panel C*/
reg CAR2 BHAR3y roafy1 mtb Sentiment  sector2-sector10 i.year  
outreg2 using CAR2, stats(coef tstat)  bdec(4) tdec(3) e(all) excel replace

reg CAR2 BHAR3y roafy1 mtb Sentiment technical_uni business_school foreign_uni master phd CEO_age DE lnmcapsek_M rd_exp_Rev  sector2-sector10 i.year  
outreg2 using CAR2, stats(coef tstat)  bdec(4) tdec(3) e(all) excel append

reg CAR2 BHAR2y roafy1 mtb Sentiment technical_uni business_school foreign_uni master phd CEO_age DE lnmcapsek_M rd_exp_Rev  sector2-sector10 i.year  
outreg2 using CAR2, stats(coef tstat)  bdec(4) tdec(3) e(all) excel append

/*Panel D*/

probit csrcomp high_unexp_ability1 CEO_age new1_tenure new1_return_assets Tobins_q new1_DE new1_volatility1 new1_rd_exp_new1_total_rev new1_sector1-new1_sector10, r
outreg2 using high_unexp_ability1, stats(coef tstat)  bdec(4) tdec(3) e(all) excel replace
margins, dydx(*)  post
estimates store tay
outreg2 [tay] using high_unexp_ability1, stats(coef tstat)  bdec(4) tdec(3)  e(all) excel append

probit policyesg high_unexp_ability1 CEO_age new1_tenure new1_return_assets Tobins_q new1_DE new1_volatility1 new1_rd_exp_new1_total_rev new1_sector1-new1_sector10, r
outreg2 using high_unexp_ability1, stats(coef tstat)  bdec(4) tdec(3) e(all) excel append
margins, dydx(*)  post
estimates store tay
outreg2 [tay] using high_unexp_ability1, stats(coef tstat)  bdec(4) tdec(3)  e(all) excel append
